<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/doctrine/BaseFormFilterDoctrine.class.php');

/**
 * BeamrSlide filter form base class.
 *
 * @package    filters
 * @subpackage BeamrSlide *
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 11675 2008-09-19 15:21:38Z fabien $
 */
class BaseBeamrSlideFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'presentation_id'  => new sfWidgetFormDoctrineChoice(array('model' => 'BeamrPresentation', 'add_empty' => true)),
      'title'            => new sfWidgetFormFilterInput(),
      'subtitle'         => new sfWidgetFormFilterInput(),
      'content'          => new sfWidgetFormFilterInput(),
      'is_plain'         => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'created_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'updated_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'thumbnail'        => new sfWidgetFormFilterInput(),
      'token'            => new sfWidgetFormFilterInput(),
      'weight'           => new sfWidgetFormFilterInput(),
      'section'          => new sfWidgetFormFilterInput(),
      'section_short'    => new sfWidgetFormFilterInput(),
      'subsection'       => new sfWidgetFormFilterInput(),
      'subsection_short' => new sfWidgetFormFilterInput(),
      'section_in_toc'   => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
    ));

    $this->setValidators(array(
      'presentation_id'  => new sfValidatorDoctrineChoice(array('required' => false, 'model' => 'BeamrPresentation', 'column' => 'id')),
      'title'            => new sfValidatorPass(array('required' => false)),
      'subtitle'         => new sfValidatorPass(array('required' => false)),
      'content'          => new sfValidatorPass(array('required' => false)),
      'is_plain'         => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'created_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'updated_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'thumbnail'        => new sfValidatorPass(array('required' => false)),
      'token'            => new sfValidatorPass(array('required' => false)),
      'weight'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'section'          => new sfValidatorPass(array('required' => false)),
      'section_short'    => new sfValidatorPass(array('required' => false)),
      'subsection'       => new sfValidatorPass(array('required' => false)),
      'subsection_short' => new sfValidatorPass(array('required' => false)),
      'section_in_toc'   => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
    ));

    $this->widgetSchema->setNameFormat('beamr_slide_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'BeamrSlide';
  }

  public function getFields()
  {
    return array(
      'id'               => 'Number',
      'presentation_id'  => 'ForeignKey',
      'title'            => 'Text',
      'subtitle'         => 'Text',
      'content'          => 'Text',
      'is_plain'         => 'Boolean',
      'created_at'       => 'Date',
      'updated_at'       => 'Date',
      'thumbnail'        => 'Text',
      'token'            => 'Text',
      'weight'           => 'Number',
      'section'          => 'Text',
      'section_short'    => 'Text',
      'subsection'       => 'Text',
      'subsection_short' => 'Text',
      'section_in_toc'   => 'Boolean',
    );
  }
}